public class RSMApprovalRedirectController
{
     public String ProcessId
   {
       get
       {
           return String.valueOf(System.currentPageReference().getParameters().get('ProcessId')).substring(0,15);  
       }
       set;
   }
   public string RelateId
   {
         get
       {
           return String.valueOf(System.currentPageReference().getParameters().get('RelateId')).substring(0,15);  
       }
       set;
   }
   
   public RSMApprovalRedirectController()
   {}
   public PageReference RedirectApprovalPage()
   {
       String ObjectPrefix= Participator_Detail_Area__c.sObjectType.getDescribe().getKeyPrefix();   
       //String OrderObjectPrefix=Order__c.sObjectType.getDescribe().getKeyPrefix();
       String CheckInventoryObjectPrefix=CheckInventory__c.sObjectType.getDescribe().getKeyPrefix();
  
       if(RelateId.substring(0,3)==ObjectPrefix)
       {
           Participator_Detail_Area__c activitInfo=[select  Activity_Information__c from Participator_Detail_Area__c where id=:RelateId];
           pageReference pr = new pageReference('/apex/SSYApproval?id='+activitInfo.Activity_Information__c);     
           pr.setredirect(true);   
           return pr;
       }
       else if(RelateId.substring(0,3)==CheckInventoryObjectPrefix)
       {
          pageReference pr = new pageReference('/apex/CityInventoryApproval?id='+RelateId);     
           pr.setredirect(true);   
           return pr;
       }
       else
       {
            pageReference pr = new pageReference('/p/process/ProcessInstanceWorkitemWizardStageManager?id='+ProcessId);     
           pr.setredirect(true);   
           return pr;
       }
   }
   
}